home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Science / RLaB / misc / configure.in < prev    next >
Text File  |  1994-04-25  |  6KB  |  252 lines

  1. dnl configure.in for RLaB
  2. dnl Process this file with autoconf to prodice a configure script
  3.  
  4. dnl The following bit of shell script was shamelessly borrowed
  5. dnl from the GNU emacs configure.in
  6.  
  7. [#!/bin/sh
  8. progname="`echo $0`"
  9.  
  10. ## Usage messages.
  11.  
  12. short_usage="Usage: ${progname} [--with-LIBS=dir] ...
  13.  
  14. Set compilation and installation parameters for RLaB.
  15. --with-LIBS=DIR        Add DIR to list of directories to search for
  16.             ALL libraries.
  17. --with-NALIBS=DIR    Search for Numerical Analysis libraries in DIR.
  18. --with-FLIBS=DIR    Search for Fortran libraries in DIR.
  19. --with-PLIBS=DIR    Search for PLPLOT Library in DIR
  20. --with-gcc        Force usage of the GNU C compiler.
  21. --with-cc        Force usage of cc(1)
  22. --prefix=DIR        Set the Makefile variable \'prefix\' to DIR.
  23.             RLaB will be installed with DIR as the root
  24.             directory.
  25.  
  26. If successful, ${progname} leaves its status in config.status.  If
  27. unsuccessful after disturbing the status quo, it removes config.status."
  28. ]
  29.  
  30. AC_INIT(rlab.h)
  31. AC_CONFIG_HEADER(config.h)
  32.  
  33. dnl Set default library search path
  34. AC_WITH(LIBS,
  35. [
  36.   LIBS="-L$withval "
  37.   LLIBS="-L$withval "
  38. ],
  39. [
  40.   LIBS="-L/usr/local/lib "
  41.   LLIBS="-L/usr/local/lib "
  42. ])
  43.  
  44. dnl Find the necessary programs
  45. AC_PROG_YACC
  46.  
  47. dnl Flex is required
  48. AC_PROGRAM_CHECK(FLEX, flex, flex)
  49. dnl AC_HAVE_LIBRARY(fl, [FLEX_LIB="$LIBS -lfl"], 
  50. dnl [
  51. dnl   echo "WARNING: you must have the flex library libfl.a"
  52. dnl ])
  53.  
  54. AC_PROG_AWK
  55. AC_PROG_INSTALL
  56. AC_PROGRAM_CHECK(F2C, f2c, f2c)
  57.  
  58. dnl Check to see if `--with-cc' or `--with-gcc'
  59. dnl was specified on the command line.
  60.  
  61. AC_WITH(cc, [CC="cc"])
  62. AC_WITH(gcc, [CC="gcc" GCC=1])
  63.  
  64. [
  65. if test -z "$CC" ; then
  66.  ] AC_PROG_CC [
  67. fi
  68. ]
  69.  
  70. dnl Determine the compiler characteristics
  71. AC_CONST
  72. AC_SIZE_T
  73. AC_WORDS_BIGENDIAN
  74.  
  75. AC_PROGRAM_CHECK(PAGER, less, less)
  76.   if test -z "$PAGER" ; then
  77.     ] AC_PROGRAM_CHECK(PAGER, more, more) [
  78.     if test -z "$PAGER" ; then
  79.       ] AC_PROGRAM_CHECK(PAGER, pg, pg) [
  80.     fi
  81.   fi
  82. ]
  83.  
  84. dnl Look for certain problematic platforms
  85. AC_PROGRAM_EGREP(yes,
  86. [#ifdef titan
  87.  yes
  88. #endif
  89. ], TITAN=1)
  90.  
  91. AC_HEADER_CHECK(elf.h, AC_DEFINE(SVR4))
  92.  
  93. dnl Find the REQUIRED numerical libraries
  94. dnl They are probably all in /usr/local/lib
  95.  
  96. AC_WITH(NALIBS, 
  97.   echo "look for Numerical Analysis LIBS in $withval"
  98.   LIBS="$LIBS -L$withval"
  99.   NALIB_DIR="-L$withval "
  100. ],
  101. [
  102.   NALIB_DIR=""
  103. ])
  104.  
  105. AC_HAVE_LIBRARY(Clapack, [NALIBS="$NALIB_DIR -lClapack"], [
  106.    echo "WARNING: Cannot find libClapack.a,  use --with-NALIBS option" ])
  107. AC_HAVE_LIBRARY(Cblas, [NALIBS="$NALIBS -lCblas"], [
  108.    echo "WARNING: Cannot find libCblas.a,    use --with-NALIBS option" ])
  109. AC_HAVE_LIBRARY(Cfftpack, [NALIBS="$NALIBS -lCfftpack"], [
  110.    echo "WARNING: Cannot find libCfftpack.a, use --with-NALIBS option" ])
  111. AC_HAVE_LIBRARY(Cranlib, [NALIBS="$NALIBS -lCranlib"], [
  112.    echo "WARNING: Cannot find libCranlib.a,  use --with-NALIBS option" ])
  113.  
  114. dnl Get libreadline.a if available
  115.  
  116. AC_HAVE_LIBRARY(readline, [CMDLIBS="$LIBS -lreadline"], [READLINE="no"])
  117. [
  118. if test -z "$READLINE" ; then
  119.   ] AC_DEFINE(HAVE_READLINE,1)
  120.     AC_HAVE_LIBRARY(termcap, [CMDLIBS="$CMDLIBS -ltermcap"]) [
  121. fi
  122. ]
  123.  
  124. dnl Find the REQUIRED f2c libraries
  125. dnl First look for libf2c.a, then for libF77.a, and libI77.a
  126. dnl if neccesary.
  127.  
  128. AC_WITH(FLIBS,
  129.   echo "look for F2C LIBS in $withval"
  130.   LIBS="$LIBS -L$withval"
  131.   FLIB_DIR="-L$withval"
  132. ],
  133. [
  134.   FLIB_DIR=""
  135. ])
  136.  
  137. AC_HAVE_LIBRARY(f2c, [FLIBS="$FLIB_DIR -lf2c"])
  138. [
  139. if test -z "$FLIBS" ; then
  140.   ] AC_HAVE_LIBRARY(F77, [FLIBS="$FLIB_DIR -lF77"])
  141.     AC_HAVE_LIBRARY(I77, [FLIBS="$FLIBS -lI77"]) [
  142.     if test -z "$FLIBS" ; then
  143.       echo "WARNING: Cannot find Fortran libraries,  use --with-FLIBS option"
  144.     fi 
  145. fi
  146. ]
  147.  
  148. dnl
  149. dnl Look for PLPLOT libraries
  150. dnl
  151.  
  152. dnl 1st set X11LIB variable
  153. [
  154. X11LIB="-lX11"
  155. ]
  156.  
  157. AC_HAVE_LIBRARY(nsl, [NSL=true])
  158. [
  159. if test -n "$NSL" ; then
  160.   LIBS="$LIBS -lnsl"
  161. ]
  162.   AC_HAVE_LIBRARY(socket, [X11LIB="$X11LIB -lsocket -lnsl"])
  163. [
  164. fi
  165. ]
  166.  
  167. AC_WITH(PLIBS,
  168.   echo "look for PLPLOT library $withval"
  169.   LIBS="$LIBS -L$withval"
  170.   PLIB_DIR="-L$withval"
  171.   PLIB_INC="$withval"
  172. ],
  173. [
  174.   LIBS="$LIBS -L/usr/local/plplot"
  175.   PLIB_DIR="-L/usr/local/plplot"
  176.   PLIB_INC="/usr/local/plplot"
  177. ])
  178.  
  179. AC_HAVE_LIBRARY(plplotdX, [PLIBS="$PLIB_DIR -lplplotdX $X11LIB"])
  180. [
  181. if test -z "$PLIBS" ; then
  182.   ] AC_HAVE_LIBRARY(plplotdtk,  
  183.     [PLIBS="$PLIB_DIR -lplplotdtk -ltk -ltcl $X11LIB"]) [
  184. fi
  185. ]
  186.  
  187. [
  188. if test -n "$PLIBS" ; then
  189.   ] AC_DEFINE(HAVE_RLAB_PLPLOT,1) [
  190.     PLOT_PROG="plplot"
  191.     PLIB_INC_DIR="-I$PLIB_INC/include"
  192.   else
  193.   ] AC_PROGRAM_CHECK(PLOT_PROG, gnuplot, gnuplot, nothing) [
  194.     PLIB_INC_DIR=""
  195. fi
  196. ]
  197.  
  198. [
  199. if test -z "$TITAN" ; then
  200. ] AC_STDC_HEADERS
  201.   AC_DIR_HEADER
  202.   AC_HAVE_HEADERS(stdlib.h time.h float.h ieeefp.h unistd.h)
  203.   dnl Look for certain functions
  204.   AC_HAVE_LIBRARY(m)
  205.   AC_HAVE_FUNCS(difftime rint rindex matherr fpsetmask)
  206.   AC_ALLOCA 
  207.   AC_HEADER_EGREP([ rint], math.h, AC_DEFINE(HAVE_RINT_DEC,1))
  208. [
  209. else
  210. ] dnl Titan P3
  211.   AC_DEFINE(TITAN, 1)
  212.   AC_DIR_HEADER
  213.   AC_HAVE_HEADERS(stdlib.h time.h unistd.h)
  214.   dnl Look for certain functions
  215.   AC_HAVE_LIBRARY(m)
  216.   AC_HAVE_FUNCS(difftime rint rindex)
  217.   AC_ALLOCA [
  218. fi
  219. ]
  220.  
  221. AC_COMPILE_CHECK([fprintf dec],[#include <stdio.h>],
  222.                  [int (*x)()=(int(*)())fprintf;],
  223.                  AC_DEFINE(HAVE_FPRINTF_DEC))
  224. AC_COMPILE_CHECK([sprintf dec],[#include <stdio.h>],
  225.                  [int (*x)()=(int(*)())sprintf;], 
  226.                  AC_DEFINE(HAVE_SPRINTF_DEC))
  227.  
  228. dnl Now do checks for getline command-line interface.
  229. dnl Getline needs to know if termios exists
  230. dnl AC_HEADER_CHECK(termios.h)
  231.  
  232. AC_SUBST(CC)
  233. AC_SUBST(F2C)
  234. AC_SUBST(FLEX)
  235. dnl AC_SUBST(FLEX_LIB)
  236. AC_SUBST(PAGER)
  237.  
  238. AC_SUBST(LLIBS)
  239. AC_SUBST(NALIBS)
  240. AC_SUBST(FLIBS)
  241. AC_SUBST(CMDLIBS)
  242. AC_SUBST(PLIBS)
  243. AC_SUBST(PLOT_PROG)
  244. AC_SUBST(PLIB_INC_DIR)
  245.  
  246. dnl done, write the Makefile
  247. AC_OUTPUT(Makefile)
  248.